package cn.fr.config;

import cn.fr.util.ProductTaskToQueue;
import cn.fr.util.TaskWorks;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ScheduledTaskConfig {
    private TaskWorks task;

    @Autowired
    public void setTask(TaskWorks task) {
        this.task = task;
    }

    //    @Bean
//    public TaskWorks taskWorks(){
//        return new TaskWorks();
//    }
    @Bean
    public CommandLineRunner schedulingRunner(TaskWorks task) {
        return args -> task.startTask();
    }
}
